#ifndef INVOICEITEM_H
#define INVOICEITEM_H

#include "Customer.h"
#include "Product.h"

namespace ecocity
{

class InvoiceItem
{

public:

    static uint s_counter;

    InvoiceItem( Customer::TYPE customer_type,
                 const Product& product,
                 int quantity,
                 float discount_rate );

    void set_quantity( int quantity );
    void set_weight( float kilograms );
    void set_discount( float discount );
    void set_product( const Product& product );

    uint id( ) const;

    Customer::TYPE customer_type( ) const;

    Product::PRICE_TYPE price_type( ) const;

    const Product& product( ) const;

    int quantity( ) const;
    float weight( ) const;

    // in percentage
    float discount_rate( ) const;
    // in euros
    float total_discount( ) const;

    // Include profit
    float total_cost( ) const;
    float taxes_cost( ) const;
    float untaxed_cost_with_discount( ) const;
    float untaxed_cost_without_discount( ) const;

    int tax_rate( ) const;

    float profit( ) const;

private:

    void update_costs( );

private:

    uint m_unique_id;

    Customer::TYPE m_customer_type;

    Product m_product;

    int m_quantity;
    // kilograms
    float m_weight;

    float m_discount_rate;
    float m_discount;

    float m_cost_without_taxes;
    float m_cost_without_taxes_without_discount;
    float m_total_taxes;
    float m_total_profit;
    float m_total_cost;
};

}      // namespace ecocity


#endif // INVOICEITEM_H
